<?php
require_once(ROOT_ADMIN_MODELS.DS.'Models_Base.php'); 
require_once(ROOT_ADMIN_MODELS.DS.'Models_Log.php'); 
require_once(ROOT_ADMIN_MODELS.DS.'Models_Log_File.php');
require_once(ROOT_LIBRARY_UTILITY.DS.'utility.php');
require_once(ROOT_ADMIN_CONTROLLERS.DS.'BaseController.php');

class Admin_LogController extends BaseController {	
		public function preDispatch()
		{
			parent::preDispatch();
			if(!$this->hasPrivilege())
				$this->_redirect ("/admin/error/permission");
		}
		
	
	public function indexAction()
	{
		$this->view ->headTitle("UIT-News Supporter");
		try
		{
			$from = "";$to ="";
			if($this->_request->isPost())
			{
				
				if($_POST['fromday'] != "");
					$from = $_POST['fromday'];
				if($_POST['today'] != "")
					$to = $_POST['today'];
			}
			$this->view->from = $from;
			$this->view->to= $to;
			$md=new Models_Log_File();
			$this->view->data=$md->listLog($from,$to);			
		}
		catch (Exception $ex)
		{
			$this->view->errMsg = $ex->getMessage();
			Utility::log($ex->getMessage(), $ex->getFile(), $ex->getLine());
		}
	} 
}
	